<div class="contentCenter">
<?php 
    echo $this->Form->create();
?>
    <table class="showFields">
        <tr>
            <th><?php __('Select Kpi')  ?></th><td>
<?php    
        echo $this->Form->input('kpiName',array('options'=>$kpiArray,'empty'=>'select','label'=>false));  
?>
            </td>
            <th><?php __('Select Exception Report')  ?></th><td>
<?php    
        echo $this->Form->input('kpiName',array('options'=>$erArray,'empty'=>'select','label'=>false));  
?>
            </td>
        </tr>
        <?php foreach ($kpiArray as $k):  ?>
        <tr class="isHidden" id="<?php e($k);  ?>">
            <td colspan="4">
                <?php echo $this->Html->link('d','/files/'.$k.'.xls',array('class'=>'downloadKpi','title'=>'Download Excel file'));    ?>
            </td>            
        </tr>
        <?php endforeach;  ?>
    </table>        
<?php 
  echo $this->Form->end();
?>
</div>
<div class="contentCenter" id="kpiContainer">
    
    
</div>


<script type="text/javascript">
    $("#KpiKpiName").live('change',function(){
        if($(this).val().length>0){  
            $('tr.isHidden').hide();
            $kpi=$(this).find('option:selected').text();
            $('#kpiContainer').empty().append('<div class="loader"></div>');
            $.post('/alwpa/kpis/'+$kpi,function(data){
                $('#kpiContainer').empty().append(data);
                if($kpi=='prm04kpi' || $kpi=='prm05kpi' || $kpi=='prm10kpi' || $kpi=='prm06kpi'){				
				$('#'+$kpi).slideDown();}
            });
        }
    });


</script>
